<?php
	/**
	 * The abstract TableUserItemGen class defined here is
	 * code-generated and contains all the basic CRUD-type functionality as well as
	 * basic methods to handle relationships and index-based loading.
	 *
	 * To use, you should use the TableUserItem subclass which
	 * extends this TableUserItemGen class.
	 *
	 * Because subsequent re-code generations will overwrite any changes to this
	 * file, you should leave this file unaltered to prevent yourself from losing
	 * any information or code changes.  All customizations should be done by
	 * overriding existing or implementing new methods, properties and variables
	 * in the TableUserItem class.
	 * 
	 * @package My Application
	 * @subpackage GeneratedDataObjects
	 * @property-read integer $Id the value for intId (Read-Only PK)
	 * @property integer $UserId the value for intUserId (Not Null)
	 * @property integer $PresentUserId the value for intPresentUserId 
	 * @property integer $ItemId the value for intItemId (Not Null)
	 * @property integer $Price the value for intPrice (Not Null)
	 * @property integer $TaxWithin the value for intTaxWithin 
	 * @property integer $Count the value for intCount 
	 * @property integer $PresentStatus the value for intPresentStatus 
	 * @property integer $LicenseDay the value for intLicenseDay 
	 * @property string $Subscription the value for strSubscription 
	 * @property string $Image the value for strImage 
	 * @property string $Simage the value for strSimage 
	 * @property QDateTime $GetDate the value for dttGetDate 
	 * @property QDateTime $SuspendDate the value for dttSuspendDate 
	 * @property QDateTime $PresentDate the value for dttPresentDate 
	 * @property QDateTime $TimeupDate the value for dttTimeupDate 
	 * @property string $Suspended the value for strSuspended (Not Null)
	 * @property string $Present the value for strPresent (Not Null)
	 * @property string $Timeup the value for strTimeup (Not Null)
	 * @property string $Active the value for strActive (Not Null)
	 * @property TableUserProject $User the value for the TableUserProject object referenced by intUserId (Not Null)
	 * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
	 */
	class TableUserItemGen extends QBaseClass {

		///////////////////////////////////////////////////////////////////////
		// PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
		///////////////////////////////////////////////////////////////////////
		
		/**
		 * Protected member variable that maps to the database PK Identity column table_user_item.id
		 * @var integer intId
		 */
		protected $intId;
		const IdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.user_id
		 * @var integer intUserId
		 */
		protected $intUserId;
		const UserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.present_user_id
		 * @var integer intPresentUserId
		 */
		protected $intPresentUserId;
		const PresentUserIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.item_id
		 * @var integer intItemId
		 */
		protected $intItemId;
		const ItemIdDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.price
		 * @var integer intPrice
		 */
		protected $intPrice;
		const PriceDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.tax_within
		 * @var integer intTaxWithin
		 */
		protected $intTaxWithin;
		const TaxWithinDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.count
		 * @var integer intCount
		 */
		protected $intCount;
		const CountDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.present_status
		 * @var integer intPresentStatus
		 */
		protected $intPresentStatus;
		const PresentStatusDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.license_day
		 * @var integer intLicenseDay
		 */
		protected $intLicenseDay;
		const LicenseDayDefault = 0;


		/**
		 * Protected member variable that maps to the database column table_user_item.subscription
		 * @var string strSubscription
		 */
		protected $strSubscription;
		const SubscriptionMaxLength = 1;
		const SubscriptionDefault = 'n';


		/**
		 * Protected member variable that maps to the database column table_user_item.image
		 * @var string strImage
		 */
		protected $strImage;
		const ImageDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.simage
		 * @var string strSimage
		 */
		protected $strSimage;
		const SimageDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.get_date
		 * @var QDateTime dttGetDate
		 */
		protected $dttGetDate;
		const GetDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.suspend_date
		 * @var QDateTime dttSuspendDate
		 */
		protected $dttSuspendDate;
		const SuspendDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.present_date
		 * @var QDateTime dttPresentDate
		 */
		protected $dttPresentDate;
		const PresentDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.timeup_date
		 * @var QDateTime dttTimeupDate
		 */
		protected $dttTimeupDate;
		const TimeupDateDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.suspended
		 * @var string strSuspended
		 */
		protected $strSuspended;
		const SuspendedMaxLength = 1;
		const SuspendedDefault = null;


		/**
		 * Protected member variable that maps to the database column table_user_item.present
		 * @var string strPresent
		 */
		protected $strPresent;
		const PresentMaxLength = 1;
		const PresentDefault = 'n';


		/**
		 * Protected member variable that maps to the database column table_user_item.timeup
		 * @var string strTimeup
		 */
		protected $strTimeup;
		const TimeupMaxLength = 1;
		const TimeupDefault = 'n';


		/**
		 * Protected member variable that maps to the database column table_user_item.active
		 * @var string strActive
		 */
		protected $strActive;
		const ActiveMaxLength = 1;
		const ActiveDefault = 'y';


		/**
		 * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
		 * columns from the run-time database query result for this object).  Used by InstantiateDbRow and
		 * GetVirtualAttribute.
		 * @var string[] $__strVirtualAttributeArray
		 */
		protected $__strVirtualAttributeArray = array();

		/**
		 * Protected internal member variable that specifies whether or not this object is Restored from the database.
		 * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
		 * @var bool __blnRestored;
		 */
		protected $__blnRestored;




		///////////////////////////////
		// PROTECTED MEMBER OBJECTS
		///////////////////////////////

		/**
		 * Protected member variable that contains the object pointed by the reference
		 * in the database column table_user_item.user_id.
		 *
		 * NOTE: Always use the User property getter to correctly retrieve this TableUserProject object.
		 * (Because this class implements late binding, this variable reference MAY be null.)
		 * @var TableUserProject objUser
		 */
		protected $objUser;





		///////////////////////////////
		// CLASS-WIDE LOAD AND COUNT METHODS
		///////////////////////////////

		/**
		 * Static method to retrieve the Database object that owns this class.
		 * @return QDatabaseBase reference to the Database object that can query this class
		 */
		public static function GetDatabase() {
			return QApplication::$Database[1];
		}

		/**
		 * Load a TableUserItem from PK Info
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem
		 */
		public static function Load($intId, $objOptionalClauses = null) {
			// Use QuerySingle to Perform the Query
			return TableUserItem::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserItem()->Id, $intId)
				),
				$objOptionalClauses
			);
		}

		/**
		 * Load all TableUserItems
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		 */
		public static function LoadAll($objOptionalClauses = null) {
			if (func_num_args() > 1) {
				throw new QCallerException("LoadAll must be called with an array of optional clauses as a single argument");
			}
			// Call TableUserItem::QueryArray to perform the LoadAll query
			try {
				return TableUserItem::QueryArray(QQ::All(), $objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count all TableUserItems
		 * @return int
		 */
		public static function CountAll() {
			// Call TableUserItem::QueryCount to perform the CountAll query
			return TableUserItem::QueryCount(QQ::All());
		}




		///////////////////////////////
		// QCUBED QUERY-RELATED METHODS
		///////////////////////////////

		/**
		 * Internally called method to assist with calling Qcubed Query for this class
		 * on load methods.
		 * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
		 * @param boolean $blnCountOnly only select a rowcount
		 * @return string the query statement
		 */
		protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();

			// Create/Build out the QueryBuilder object with TableUserItem-specific SELET and FROM fields
			$objQueryBuilder = new QQueryBuilder($objDatabase, 'table_user_item');
			TableUserItem::GetSelectFields($objQueryBuilder);
			$objQueryBuilder->AddFromItem('table_user_item');

			// Set "CountOnly" option (if applicable)
			if ($blnCountOnly)
				$objQueryBuilder->SetCountOnlyFlag();

			// Apply Any Conditions
			if ($objConditions)
				try {
					$objConditions->UpdateQueryBuilder($objQueryBuilder);
				} catch (QCallerException $objExc) {
					$objExc->IncrementOffset();
					throw $objExc;
				}

			// Iterate through all the Optional Clauses (if any) and perform accordingly
			if ($objOptionalClauses) {
				if ($objOptionalClauses instanceof QQClause)
					$objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
				else if (is_array($objOptionalClauses))
					foreach ($objOptionalClauses as $objClause)
						$objClause->UpdateQueryBuilder($objQueryBuilder);
				else
					throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
			}

			// Get the SQL Statement
			$strQuery = $objQueryBuilder->GetStatement();

			// Prepare the Statement with the Query Parameters (if applicable)
			if ($mixParameterArray) {
				if (is_array($mixParameterArray)) {
					if (count($mixParameterArray))
						$strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);

					// Ensure that there are no other Unresolved Named Parameters
					if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
						throw new QCallerException('Unresolved named parameters in the query');
				} else
					throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
			}

			// Return the Objects
			return $strQuery;
		}

		/**
		 * Static Qcubed Query method to query for a single TableUserItem object.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserItem the queried object
		 */
		public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserItem::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
			
			// Perform the Query, Get the First Row, and Instantiate a new TableUserItem object
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			
			// Do we have to expand anything?
			if ($objQueryBuilder->ExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserItem::InstantiateDbRow($objDbRow, null, $objQueryBuilder->ExpandAsArrayNodes, $objToReturn, $objQueryBuilder->ColumnAliasArray);
					if ($objItem)
						$objToReturn[] = $objItem;					
				}			
				// Since we only want the object to return, lets return the object and not the array.
				return $objToReturn[0];
			} else {
				// No expands just return the first row
				$objToReturn = null;
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn = TableUserItem::InstantiateDbRow($objDbRow, null, null, null, $objQueryBuilder->ColumnAliasArray);
			}
			
			return $objToReturn;
		}

		/**
		 * Static Qcubed Query method to query for an array of TableUserItem objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return TableUserItem[] the queried objects as an array
		 */
		public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserItem::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and Instantiate the Array Result
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);
			return TableUserItem::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
		}

		/**
		 * Static Qcubed Query method to query for a count of TableUserItem objects.
		 * Uses BuildQueryStatment to perform most of the work.
		 * @param QQCondition $objConditions any conditions on the query, itself
		 * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
		 * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
		 * @return integer the count of queried objects as an integer
		 */
		public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
			// Get the Query Statement
			try {
				$strQuery = TableUserItem::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Perform the Query and return the row_count
			$objDbResult = $objQueryBuilder->Database->Query($strQuery);

			// Figure out if the query is using GroupBy
			$blnGrouped = false;

			if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
				if ($objClause instanceof QQGroupBy) {
					$blnGrouped = true;
					break;
				}
			}

			if ($blnGrouped)
				// Groups in this query - return the count of Groups (which is the count of all rows)
				return $objDbResult->CountRows();
			else {
				// No Groups - return the sql-calculated count(*) value
				$strDbRow = $objDbResult->FetchRow();
				return QType::Cast($strDbRow[0], QType::Integer);
			}
		}

		public static function QueryArrayCached(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();

			$strQuery = TableUserItem::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
			
			$objCache = new QCache('qquery/tableuseritem', $strQuery);
			$cacheData = $objCache->GetData();
			
			if (!$cacheData || $blnForceUpdate) {
				$objDbResult = $objQueryBuilder->Database->Query($strQuery);
				$arrResult = TableUserItem::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
				$objCache->SaveData(serialize($arrResult));
			} else {
				$arrResult = unserialize($cacheData);
			}
			
			return $arrResult;
		}

		/**
		 * Updates a QQueryBuilder with the SELECT fields for this TableUserItem
		 * @param QQueryBuilder $objBuilder the Query Builder object to update
		 * @param string $strPrefix optional prefix to add to the SELECT fields
		 */
		public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
			if ($strPrefix) {
				$strTableName = $strPrefix;
				$strAliasPrefix = $strPrefix . '__';
			} else {
				$strTableName = 'table_user_item';
				$strAliasPrefix = '';
			}

			$objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
			$objBuilder->AddSelectItem($strTableName, 'user_id', $strAliasPrefix . 'user_id');
			$objBuilder->AddSelectItem($strTableName, 'present_user_id', $strAliasPrefix . 'present_user_id');
			$objBuilder->AddSelectItem($strTableName, 'item_id', $strAliasPrefix . 'item_id');
			$objBuilder->AddSelectItem($strTableName, 'price', $strAliasPrefix . 'price');
			$objBuilder->AddSelectItem($strTableName, 'tax_within', $strAliasPrefix . 'tax_within');
			$objBuilder->AddSelectItem($strTableName, 'count', $strAliasPrefix . 'count');
			$objBuilder->AddSelectItem($strTableName, 'present_status', $strAliasPrefix . 'present_status');
			$objBuilder->AddSelectItem($strTableName, 'license_day', $strAliasPrefix . 'license_day');
			$objBuilder->AddSelectItem($strTableName, 'subscription', $strAliasPrefix . 'subscription');
			$objBuilder->AddSelectItem($strTableName, 'image', $strAliasPrefix . 'image');
			$objBuilder->AddSelectItem($strTableName, 'simage', $strAliasPrefix . 'simage');
			$objBuilder->AddSelectItem($strTableName, 'get_date', $strAliasPrefix . 'get_date');
			$objBuilder->AddSelectItem($strTableName, 'suspend_date', $strAliasPrefix . 'suspend_date');
			$objBuilder->AddSelectItem($strTableName, 'present_date', $strAliasPrefix . 'present_date');
			$objBuilder->AddSelectItem($strTableName, 'timeup_date', $strAliasPrefix . 'timeup_date');
			$objBuilder->AddSelectItem($strTableName, 'suspended', $strAliasPrefix . 'suspended');
			$objBuilder->AddSelectItem($strTableName, 'present', $strAliasPrefix . 'present');
			$objBuilder->AddSelectItem($strTableName, 'timeup', $strAliasPrefix . 'timeup');
			$objBuilder->AddSelectItem($strTableName, 'active', $strAliasPrefix . 'active');
		}



		///////////////////////////////
		// INSTANTIATION-RELATED METHODS
		///////////////////////////////

		/**
		 * Instantiate a TableUserItem from a Database Row.
		 * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
		 * is calling this TableUserItem::InstantiateDbRow in order to perform
		 * early binding on referenced objects.
		 * @param DatabaseRowBase $objDbRow
		 * @param string $strAliasPrefix
		 * @param string $strExpandAsArrayNodes
		 * @param QBaseClass $arrPreviousItem
		 * @param string[] $strColumnAliasArray
		 * @return TableUserItem
		*/
		public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $arrPreviousItems = null, $strColumnAliasArray = array()) {
			// If blank row, return null
			if (!$objDbRow) {
				return null;
			}

			// Create a new instance of the TableUserItem object
			$objToReturn = new TableUserItem();
			$objToReturn->__blnRestored = true;

			$strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
			$objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'user_id'] : $strAliasPrefix . 'user_id';
			$objToReturn->intUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'present_user_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'present_user_id'] : $strAliasPrefix . 'present_user_id';
			$objToReturn->intPresentUserId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'item_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'item_id'] : $strAliasPrefix . 'item_id';
			$objToReturn->intItemId = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'price', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'price'] : $strAliasPrefix . 'price';
			$objToReturn->intPrice = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'tax_within', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'tax_within'] : $strAliasPrefix . 'tax_within';
			$objToReturn->intTaxWithin = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'count', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'count'] : $strAliasPrefix . 'count';
			$objToReturn->intCount = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'present_status', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'present_status'] : $strAliasPrefix . 'present_status';
			$objToReturn->intPresentStatus = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'license_day', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'license_day'] : $strAliasPrefix . 'license_day';
			$objToReturn->intLicenseDay = $objDbRow->GetColumn($strAliasName, 'Integer');
			$strAliasName = array_key_exists($strAliasPrefix . 'subscription', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'subscription'] : $strAliasPrefix . 'subscription';
			$objToReturn->strSubscription = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'image', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'image'] : $strAliasPrefix . 'image';
			$objToReturn->strImage = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'simage', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'simage'] : $strAliasPrefix . 'simage';
			$objToReturn->strSimage = $objDbRow->GetColumn($strAliasName, 'Blob');
			$strAliasName = array_key_exists($strAliasPrefix . 'get_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'get_date'] : $strAliasPrefix . 'get_date';
			$objToReturn->dttGetDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'suspend_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'suspend_date'] : $strAliasPrefix . 'suspend_date';
			$objToReturn->dttSuspendDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'present_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'present_date'] : $strAliasPrefix . 'present_date';
			$objToReturn->dttPresentDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'timeup_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'timeup_date'] : $strAliasPrefix . 'timeup_date';
			$objToReturn->dttTimeupDate = $objDbRow->GetColumn($strAliasName, 'DateTime');
			$strAliasName = array_key_exists($strAliasPrefix . 'suspended', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'suspended'] : $strAliasPrefix . 'suspended';
			$objToReturn->strSuspended = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'present', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'present'] : $strAliasPrefix . 'present';
			$objToReturn->strPresent = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'timeup', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'timeup'] : $strAliasPrefix . 'timeup';
			$objToReturn->strTimeup = $objDbRow->GetColumn($strAliasName, 'VarChar');
			$strAliasName = array_key_exists($strAliasPrefix . 'active', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'active'] : $strAliasPrefix . 'active';
			$objToReturn->strActive = $objDbRow->GetColumn($strAliasName, 'VarChar');

			if (isset($arrPreviousItems) && is_array($arrPreviousItems)) {
				foreach ($arrPreviousItems as $objPreviousItem) {
					if ($objToReturn->Id != $objPreviousItem->Id) {
						continue;
					}

					// complete match - all primary key columns are the same
					return null;
				}
			}

			// Instantiate Virtual Attributes
			foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
				$strVirtualPrefix = $strAliasPrefix . '__';
				$strVirtualPrefixLength = strlen($strVirtualPrefix);
				if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
					$objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
			}

			// Prepare to Check for Early/Virtual Binding
			if (!$strAliasPrefix)
				$strAliasPrefix = 'table_user_item__';

			// Check for User Early Binding
			$strAlias = $strAliasPrefix . 'user_id__id';
			$strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
			if (!is_null($objDbRow->GetColumn($strAliasName)))
				$objToReturn->objUser = TableUserProject::InstantiateDbRow($objDbRow, $strAliasPrefix . 'user_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);




			return $objToReturn;
		}

		/**
		 * Instantiate an array of TableUserItems from a Database Result
		 * @param DatabaseResultBase $objDbResult
		 * @param string $strExpandAsArrayNodes
		 * @param string[] $strColumnAliasArray
		 * @return TableUserItem[]
		 */
		public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
			$objToReturn = array();
			
			if (!$strColumnAliasArray)
				$strColumnAliasArray = array();

			// If blank resultset, then return empty array
			if (!$objDbResult)
				return $objToReturn;

			// Load up the return array with each row
			if ($strExpandAsArrayNodes) {
				$objToReturn = array();
				while ($objDbRow = $objDbResult->GetNextRow()) {
					$objItem = TableUserItem::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objToReturn, $strColumnAliasArray);
					if ($objItem) {
						$objToReturn[] = $objItem;
					}
				}
			} else {
				while ($objDbRow = $objDbResult->GetNextRow())
					$objToReturn[] = TableUserItem::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
			}

			return $objToReturn;
		}



		///////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Single Load and Array)
		///////////////////////////////////////////////////
			
		/**
		 * Load a single TableUserItem object,
		 * by Id Index(es)
		 * @param integer $intId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem
		*/
		public static function LoadById($intId, $objOptionalClauses = null) {
			return TableUserItem::QuerySingle(
				QQ::AndCondition(
					QQ::Equal(QQN::TableUserItem()->Id, $intId)
				),
				$objOptionalClauses
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByUserId($intUserId, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByUserId query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->UserId, $intUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by UserId Index(es)
		 * @param integer $intUserId
		 * @return int
		*/
		public static function CountByUserId($intUserId) {
			// Call TableUserItem::QueryCount to perform the CountByUserId query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->UserId, $intUserId)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by PresentUserId Index(es)
		 * @param integer $intPresentUserId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByPresentUserId($intPresentUserId, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByPresentUserId query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->PresentUserId, $intPresentUserId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by PresentUserId Index(es)
		 * @param integer $intPresentUserId
		 * @return int
		*/
		public static function CountByPresentUserId($intPresentUserId) {
			// Call TableUserItem::QueryCount to perform the CountByPresentUserId query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->PresentUserId, $intPresentUserId)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by ItemId Index(es)
		 * @param integer $intItemId
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByItemId($intItemId, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByItemId query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->ItemId, $intItemId),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by ItemId Index(es)
		 * @param integer $intItemId
		 * @return int
		*/
		public static function CountByItemId($intItemId) {
			// Call TableUserItem::QueryCount to perform the CountByItemId query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->ItemId, $intItemId)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Price Index(es)
		 * @param integer $intPrice
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByPrice($intPrice, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByPrice query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Price, $intPrice),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Price Index(es)
		 * @param integer $intPrice
		 * @return int
		*/
		public static function CountByPrice($intPrice) {
			// Call TableUserItem::QueryCount to perform the CountByPrice query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Price, $intPrice)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by TaxWithin Index(es)
		 * @param integer $intTaxWithin
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByTaxWithin($intTaxWithin, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByTaxWithin query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->TaxWithin, $intTaxWithin),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by TaxWithin Index(es)
		 * @param integer $intTaxWithin
		 * @return int
		*/
		public static function CountByTaxWithin($intTaxWithin) {
			// Call TableUserItem::QueryCount to perform the CountByTaxWithin query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->TaxWithin, $intTaxWithin)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Count Index(es)
		 * @param integer $intCount
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByCount($intCount, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByCount query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Count, $intCount),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Count Index(es)
		 * @param integer $intCount
		 * @return int
		*/
		public static function CountByCount($intCount) {
			// Call TableUserItem::QueryCount to perform the CountByCount query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Count, $intCount)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by PresentStatus Index(es)
		 * @param integer $intPresentStatus
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByPresentStatus($intPresentStatus, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByPresentStatus query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->PresentStatus, $intPresentStatus),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by PresentStatus Index(es)
		 * @param integer $intPresentStatus
		 * @return int
		*/
		public static function CountByPresentStatus($intPresentStatus) {
			// Call TableUserItem::QueryCount to perform the CountByPresentStatus query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->PresentStatus, $intPresentStatus)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by LicenseDay Index(es)
		 * @param integer $intLicenseDay
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByLicenseDay($intLicenseDay, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByLicenseDay query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->LicenseDay, $intLicenseDay),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by LicenseDay Index(es)
		 * @param integer $intLicenseDay
		 * @return int
		*/
		public static function CountByLicenseDay($intLicenseDay) {
			// Call TableUserItem::QueryCount to perform the CountByLicenseDay query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->LicenseDay, $intLicenseDay)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Subscription Index(es)
		 * @param string $strSubscription
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayBySubscription($strSubscription, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayBySubscription query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Subscription, $strSubscription),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Subscription Index(es)
		 * @param string $strSubscription
		 * @return int
		*/
		public static function CountBySubscription($strSubscription) {
			// Call TableUserItem::QueryCount to perform the CountBySubscription query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Subscription, $strSubscription)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by GetDate Index(es)
		 * @param QDateTime $dttGetDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByGetDate($dttGetDate, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByGetDate query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->GetDate, $dttGetDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by GetDate Index(es)
		 * @param QDateTime $dttGetDate
		 * @return int
		*/
		public static function CountByGetDate($dttGetDate) {
			// Call TableUserItem::QueryCount to perform the CountByGetDate query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->GetDate, $dttGetDate)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by SuspendDate Index(es)
		 * @param QDateTime $dttSuspendDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayBySuspendDate($dttSuspendDate, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayBySuspendDate query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->SuspendDate, $dttSuspendDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by SuspendDate Index(es)
		 * @param QDateTime $dttSuspendDate
		 * @return int
		*/
		public static function CountBySuspendDate($dttSuspendDate) {
			// Call TableUserItem::QueryCount to perform the CountBySuspendDate query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->SuspendDate, $dttSuspendDate)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by PresentDate Index(es)
		 * @param QDateTime $dttPresentDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByPresentDate($dttPresentDate, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByPresentDate query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->PresentDate, $dttPresentDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by PresentDate Index(es)
		 * @param QDateTime $dttPresentDate
		 * @return int
		*/
		public static function CountByPresentDate($dttPresentDate) {
			// Call TableUserItem::QueryCount to perform the CountByPresentDate query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->PresentDate, $dttPresentDate)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by TimeupDate Index(es)
		 * @param QDateTime $dttTimeupDate
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByTimeupDate($dttTimeupDate, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByTimeupDate query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->TimeupDate, $dttTimeupDate),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by TimeupDate Index(es)
		 * @param QDateTime $dttTimeupDate
		 * @return int
		*/
		public static function CountByTimeupDate($dttTimeupDate) {
			// Call TableUserItem::QueryCount to perform the CountByTimeupDate query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->TimeupDate, $dttTimeupDate)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Suspended Index(es)
		 * @param string $strSuspended
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayBySuspended($strSuspended, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayBySuspended query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Suspended, $strSuspended),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Suspended Index(es)
		 * @param string $strSuspended
		 * @return int
		*/
		public static function CountBySuspended($strSuspended) {
			// Call TableUserItem::QueryCount to perform the CountBySuspended query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Suspended, $strSuspended)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Present Index(es)
		 * @param string $strPresent
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByPresent($strPresent, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByPresent query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Present, $strPresent),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Present Index(es)
		 * @param string $strPresent
		 * @return int
		*/
		public static function CountByPresent($strPresent) {
			// Call TableUserItem::QueryCount to perform the CountByPresent query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Present, $strPresent)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Timeup Index(es)
		 * @param string $strTimeup
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByTimeup($strTimeup, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByTimeup query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Timeup, $strTimeup),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Timeup Index(es)
		 * @param string $strTimeup
		 * @return int
		*/
		public static function CountByTimeup($strTimeup) {
			// Call TableUserItem::QueryCount to perform the CountByTimeup query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Timeup, $strTimeup)
			);
		}
			
		/**
		 * Load an array of TableUserItem objects,
		 * by Active Index(es)
		 * @param string $strActive
		 * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
		 * @return TableUserItem[]
		*/
		public static function LoadArrayByActive($strActive, $objOptionalClauses = null) {
			// Call TableUserItem::QueryArray to perform the LoadArrayByActive query
			try {
				return TableUserItem::QueryArray(
					QQ::Equal(QQN::TableUserItem()->Active, $strActive),
					$objOptionalClauses);
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * Count TableUserItems
		 * by Active Index(es)
		 * @param string $strActive
		 * @return int
		*/
		public static function CountByActive($strActive) {
			// Call TableUserItem::QueryCount to perform the CountByActive query
			return TableUserItem::QueryCount(
				QQ::Equal(QQN::TableUserItem()->Active, $strActive)
			);
		}



		////////////////////////////////////////////////////
		// INDEX-BASED LOAD METHODS (Array via Many to Many)
		////////////////////////////////////////////////////




		//////////////////////////
		// SAVE, DELETE AND RELOAD
		//////////////////////////

		/**
		 * Save this TableUserItem
		 * @param bool $blnForceInsert
		 * @param bool $blnForceUpdate
		 * @return int
		 */
		public function Save($blnForceInsert = false, $blnForceUpdate = false) {
			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();

			$mixToReturn = null;

			try {
				if ((!$this->__blnRestored) || ($blnForceInsert)) {
					// Perform an INSERT query
					$objDatabase->NonQuery('
						INSERT INTO `table_user_item` (
							`user_id`,
							`present_user_id`,
							`item_id`,
							`price`,
							`tax_within`,
							`count`,
							`present_status`,
							`license_day`,
							`subscription`,
							`image`,
							`simage`,
							`get_date`,
							`suspend_date`,
							`present_date`,
							`timeup_date`,
							`suspended`,
							`present`,
							`timeup`,
							`active`
						) VALUES (
							' . $objDatabase->SqlVariable($this->intUserId) . ',
							' . $objDatabase->SqlVariable($this->intPresentUserId) . ',
							' . $objDatabase->SqlVariable($this->intItemId) . ',
							' . $objDatabase->SqlVariable($this->intPrice) . ',
							' . $objDatabase->SqlVariable($this->intTaxWithin) . ',
							' . $objDatabase->SqlVariable($this->intCount) . ',
							' . $objDatabase->SqlVariable($this->intPresentStatus) . ',
							' . $objDatabase->SqlVariable($this->intLicenseDay) . ',
							' . $objDatabase->SqlVariable($this->strSubscription) . ',
							' . $objDatabase->SqlVariable($this->strImage) . ',
							' . $objDatabase->SqlVariable($this->strSimage) . ',
							' . $objDatabase->SqlVariable($this->dttGetDate) . ',
							' . $objDatabase->SqlVariable($this->dttSuspendDate) . ',
							' . $objDatabase->SqlVariable($this->dttPresentDate) . ',
							' . $objDatabase->SqlVariable($this->dttTimeupDate) . ',
							' . $objDatabase->SqlVariable($this->strSuspended) . ',
							' . $objDatabase->SqlVariable($this->strPresent) . ',
							' . $objDatabase->SqlVariable($this->strTimeup) . ',
							' . $objDatabase->SqlVariable($this->strActive) . '
						)
					');

					// Update Identity column and return its value
					$mixToReturn = $this->intId = $objDatabase->InsertId('table_user_item', 'id');
				} else {
					// Perform an UPDATE query

					// First checking for Optimistic Locking constraints (if applicable)

					// Perform the UPDATE query
					$objDatabase->NonQuery('
						UPDATE
							`table_user_item`
						SET
							`user_id` = ' . $objDatabase->SqlVariable($this->intUserId) . ',
							`present_user_id` = ' . $objDatabase->SqlVariable($this->intPresentUserId) . ',
							`item_id` = ' . $objDatabase->SqlVariable($this->intItemId) . ',
							`price` = ' . $objDatabase->SqlVariable($this->intPrice) . ',
							`tax_within` = ' . $objDatabase->SqlVariable($this->intTaxWithin) . ',
							`count` = ' . $objDatabase->SqlVariable($this->intCount) . ',
							`present_status` = ' . $objDatabase->SqlVariable($this->intPresentStatus) . ',
							`license_day` = ' . $objDatabase->SqlVariable($this->intLicenseDay) . ',
							`subscription` = ' . $objDatabase->SqlVariable($this->strSubscription) . ',
							`image` = ' . $objDatabase->SqlVariable($this->strImage) . ',
							`simage` = ' . $objDatabase->SqlVariable($this->strSimage) . ',
							`get_date` = ' . $objDatabase->SqlVariable($this->dttGetDate) . ',
							`suspend_date` = ' . $objDatabase->SqlVariable($this->dttSuspendDate) . ',
							`present_date` = ' . $objDatabase->SqlVariable($this->dttPresentDate) . ',
							`timeup_date` = ' . $objDatabase->SqlVariable($this->dttTimeupDate) . ',
							`suspended` = ' . $objDatabase->SqlVariable($this->strSuspended) . ',
							`present` = ' . $objDatabase->SqlVariable($this->strPresent) . ',
							`timeup` = ' . $objDatabase->SqlVariable($this->strTimeup) . ',
							`active` = ' . $objDatabase->SqlVariable($this->strActive) . '
						WHERE
							`id` = ' . $objDatabase->SqlVariable($this->intId) . '
					');
				}

			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}

			// Update __blnRestored and any Non-Identity PK Columns (if applicable)
			$this->__blnRestored = true;


			// Return 
			return $mixToReturn;
		}

		/**
		 * Delete this TableUserItem
		 * @return void
		 */
		public function Delete() {
			if ((is_null($this->intId)))
				throw new QUndefinedPrimaryKeyException('Cannot delete this TableUserItem with an unset primary key.');

			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();


			// Perform the SQL Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_item`
				WHERE
					`id` = ' . $objDatabase->SqlVariable($this->intId) . '');
		}

		/**
		 * Delete all TableUserItems
		 * @return void
		 */
		public static function DeleteAll() {
			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				DELETE FROM
					`table_user_item`');
		}

		/**
		 * Truncate table_user_item table
		 * @return void
		 */
		public static function Truncate() {
			// Get the Database Object for this Class
			$objDatabase = TableUserItem::GetDatabase();

			// Perform the Query
			$objDatabase->NonQuery('
				TRUNCATE `table_user_item`');
		}

		/**
		 * Reload this TableUserItem from the database.
		 * @return void
		 */
		public function Reload() {
			// Make sure we are actually Restored from the database
			if (!$this->__blnRestored)
				throw new QCallerException('Cannot call Reload() on a new, unsaved TableUserItem object.');

			// Reload the Object
			$objReloaded = TableUserItem::Load($this->intId);

			// Update $this's local variables to match
			$this->UserId = $objReloaded->UserId;
			$this->intPresentUserId = $objReloaded->intPresentUserId;
			$this->intItemId = $objReloaded->intItemId;
			$this->intPrice = $objReloaded->intPrice;
			$this->intTaxWithin = $objReloaded->intTaxWithin;
			$this->intCount = $objReloaded->intCount;
			$this->intPresentStatus = $objReloaded->intPresentStatus;
			$this->intLicenseDay = $objReloaded->intLicenseDay;
			$this->strSubscription = $objReloaded->strSubscription;
			$this->strImage = $objReloaded->strImage;
			$this->strSimage = $objReloaded->strSimage;
			$this->dttGetDate = $objReloaded->dttGetDate;
			$this->dttSuspendDate = $objReloaded->dttSuspendDate;
			$this->dttPresentDate = $objReloaded->dttPresentDate;
			$this->dttTimeupDate = $objReloaded->dttTimeupDate;
			$this->strSuspended = $objReloaded->strSuspended;
			$this->strPresent = $objReloaded->strPresent;
			$this->strTimeup = $objReloaded->strTimeup;
			$this->strActive = $objReloaded->strActive;
		}



		////////////////////
		// PUBLIC OVERRIDERS
		////////////////////

				/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'Id':
					/**
					 * Gets the value for intId (Read-Only PK)
					 * @return integer
					 */
					return $this->intId;

				case 'UserId':
					/**
					 * Gets the value for intUserId (Not Null)
					 * @return integer
					 */
					return $this->intUserId;

				case 'PresentUserId':
					/**
					 * Gets the value for intPresentUserId 
					 * @return integer
					 */
					return $this->intPresentUserId;

				case 'ItemId':
					/**
					 * Gets the value for intItemId (Not Null)
					 * @return integer
					 */
					return $this->intItemId;

				case 'Price':
					/**
					 * Gets the value for intPrice (Not Null)
					 * @return integer
					 */
					return $this->intPrice;

				case 'TaxWithin':
					/**
					 * Gets the value for intTaxWithin 
					 * @return integer
					 */
					return $this->intTaxWithin;

				case 'Count':
					/**
					 * Gets the value for intCount 
					 * @return integer
					 */
					return $this->intCount;

				case 'PresentStatus':
					/**
					 * Gets the value for intPresentStatus 
					 * @return integer
					 */
					return $this->intPresentStatus;

				case 'LicenseDay':
					/**
					 * Gets the value for intLicenseDay 
					 * @return integer
					 */
					return $this->intLicenseDay;

				case 'Subscription':
					/**
					 * Gets the value for strSubscription 
					 * @return string
					 */
					return $this->strSubscription;

				case 'Image':
					/**
					 * Gets the value for strImage 
					 * @return string
					 */
					return $this->strImage;

				case 'Simage':
					/**
					 * Gets the value for strSimage 
					 * @return string
					 */
					return $this->strSimage;

				case 'GetDate':
					/**
					 * Gets the value for dttGetDate 
					 * @return QDateTime
					 */
					return $this->dttGetDate;

				case 'SuspendDate':
					/**
					 * Gets the value for dttSuspendDate 
					 * @return QDateTime
					 */
					return $this->dttSuspendDate;

				case 'PresentDate':
					/**
					 * Gets the value for dttPresentDate 
					 * @return QDateTime
					 */
					return $this->dttPresentDate;

				case 'TimeupDate':
					/**
					 * Gets the value for dttTimeupDate 
					 * @return QDateTime
					 */
					return $this->dttTimeupDate;

				case 'Suspended':
					/**
					 * Gets the value for strSuspended (Not Null)
					 * @return string
					 */
					return $this->strSuspended;

				case 'Present':
					/**
					 * Gets the value for strPresent (Not Null)
					 * @return string
					 */
					return $this->strPresent;

				case 'Timeup':
					/**
					 * Gets the value for strTimeup (Not Null)
					 * @return string
					 */
					return $this->strTimeup;

				case 'Active':
					/**
					 * Gets the value for strActive (Not Null)
					 * @return string
					 */
					return $this->strActive;


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Gets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @return TableUserProject
					 */
					try {
						if ((!$this->objUser) && (!is_null($this->intUserId)))
							$this->objUser = TableUserProject::Load($this->intUserId);
						return $this->objUser;
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				////////////////////////////
				// Virtual Object References (Many to Many and Reverse References)
				// (If restored via a "Many-to" expansion)
				////////////////////////////


				case '__Restored':
					return $this->__blnRestored;

				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

				/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			switch ($strName) {
				///////////////////
				// Member Variables
				///////////////////
				case 'UserId':
					/**
					 * Sets the value for intUserId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						$this->objUser = null;
						return ($this->intUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PresentUserId':
					/**
					 * Sets the value for intPresentUserId 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPresentUserId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'ItemId':
					/**
					 * Sets the value for intItemId (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intItemId = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Price':
					/**
					 * Sets the value for intPrice (Not Null)
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPrice = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TaxWithin':
					/**
					 * Sets the value for intTaxWithin 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intTaxWithin = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Count':
					/**
					 * Sets the value for intCount 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intCount = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PresentStatus':
					/**
					 * Sets the value for intPresentStatus 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intPresentStatus = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'LicenseDay':
					/**
					 * Sets the value for intLicenseDay 
					 * @param integer $mixValue
					 * @return integer
					 */
					try {
						return ($this->intLicenseDay = QType::Cast($mixValue, QType::Integer));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Subscription':
					/**
					 * Sets the value for strSubscription 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strSubscription = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Image':
					/**
					 * Sets the value for strImage 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strImage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Simage':
					/**
					 * Sets the value for strSimage 
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strSimage = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'GetDate':
					/**
					 * Sets the value for dttGetDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttGetDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'SuspendDate':
					/**
					 * Sets the value for dttSuspendDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttSuspendDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'PresentDate':
					/**
					 * Sets the value for dttPresentDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttPresentDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'TimeupDate':
					/**
					 * Sets the value for dttTimeupDate 
					 * @param QDateTime $mixValue
					 * @return QDateTime
					 */
					try {
						return ($this->dttTimeupDate = QType::Cast($mixValue, QType::DateTime));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Suspended':
					/**
					 * Sets the value for strSuspended (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strSuspended = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Present':
					/**
					 * Sets the value for strPresent (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strPresent = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Timeup':
					/**
					 * Sets the value for strTimeup (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strTimeup = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}

				case 'Active':
					/**
					 * Sets the value for strActive (Not Null)
					 * @param string $mixValue
					 * @return string
					 */
					try {
						return ($this->strActive = QType::Cast($mixValue, QType::String));
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}


				///////////////////
				// Member Objects
				///////////////////
				case 'User':
					/**
					 * Sets the value for the TableUserProject object referenced by intUserId (Not Null)
					 * @param TableUserProject $mixValue
					 * @return TableUserProject
					 */
					if (is_null($mixValue)) {
						$this->intUserId = null;
						$this->objUser = null;
						return null;
					} else {
						// Make sure $mixValue actually is a TableUserProject object
						try {
							$mixValue = QType::Cast($mixValue, 'TableUserProject');
						} catch (QInvalidCastException $objExc) {
							$objExc->IncrementOffset();
							throw $objExc;
						} 

						// Make sure $mixValue is a SAVED TableUserProject object
						if (is_null($mixValue->Id))
							throw new QCallerException('Unable to set an unsaved User for this TableUserItem');

						// Update Local Member Variables
						$this->objUser = $mixValue;
						$this->intUserId = $mixValue->Id;

						// Return $mixValue
						return $mixValue;
					}
					break;

				default:
					try {
						return parent::__set($strName, $mixValue);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Lookup a VirtualAttribute value (if applicable).  Returns NULL if none found.
		 * @param string $strName
		 * @return string
		 */
		public function GetVirtualAttribute($strName) {
			if (array_key_exists($strName, $this->__strVirtualAttributeArray))
				return $this->__strVirtualAttributeArray[$strName];
			return null;
		}



		///////////////////////////////
		// ASSOCIATED OBJECTS' METHODS
		///////////////////////////////





		////////////////////////////////////////
		// METHODS for SOAP-BASED WEB SERVICES
		////////////////////////////////////////

		public static function GetSoapComplexTypeXml() {
			$strToReturn = '<complexType name="TableUserItem"><sequence>';
			$strToReturn .= '<element name="Id" type="xsd:int"/>';
			$strToReturn .= '<element name="User" type="xsd1:TableUserProject"/>';
			$strToReturn .= '<element name="PresentUserId" type="xsd:int"/>';
			$strToReturn .= '<element name="ItemId" type="xsd:int"/>';
			$strToReturn .= '<element name="Price" type="xsd:int"/>';
			$strToReturn .= '<element name="TaxWithin" type="xsd:int"/>';
			$strToReturn .= '<element name="Count" type="xsd:int"/>';
			$strToReturn .= '<element name="PresentStatus" type="xsd:int"/>';
			$strToReturn .= '<element name="LicenseDay" type="xsd:int"/>';
			$strToReturn .= '<element name="Subscription" type="xsd:string"/>';
			$strToReturn .= '<element name="Image" type="xsd:string"/>';
			$strToReturn .= '<element name="Simage" type="xsd:string"/>';
			$strToReturn .= '<element name="GetDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="SuspendDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="PresentDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="TimeupDate" type="xsd:dateTime"/>';
			$strToReturn .= '<element name="Suspended" type="xsd:string"/>';
			$strToReturn .= '<element name="Present" type="xsd:string"/>';
			$strToReturn .= '<element name="Timeup" type="xsd:string"/>';
			$strToReturn .= '<element name="Active" type="xsd:string"/>';
			$strToReturn .= '<element name="__blnRestored" type="xsd:boolean"/>';
			$strToReturn .= '</sequence></complexType>';
			return $strToReturn;
		}

		public static function AlterSoapComplexTypeArray(&$strComplexTypeArray) {
			if (!array_key_exists('TableUserItem', $strComplexTypeArray)) {
				$strComplexTypeArray['TableUserItem'] = TableUserItem::GetSoapComplexTypeXml();
				TableUserProject::AlterSoapComplexTypeArray($strComplexTypeArray);
			}
		}

		public static function GetArrayFromSoapArray($objSoapArray) {
			$objArrayToReturn = array();

			foreach ($objSoapArray as $objSoapObject)
				array_push($objArrayToReturn, TableUserItem::GetObjectFromSoapObject($objSoapObject));

			return $objArrayToReturn;
		}

		public static function GetObjectFromSoapObject($objSoapObject) {
			$objToReturn = new TableUserItem();
			if (property_exists($objSoapObject, 'Id'))
				$objToReturn->intId = $objSoapObject->Id;
			if ((property_exists($objSoapObject, 'User')) &&
				($objSoapObject->User))
				$objToReturn->User = TableUserProject::GetObjectFromSoapObject($objSoapObject->User);
			if (property_exists($objSoapObject, 'PresentUserId'))
				$objToReturn->intPresentUserId = $objSoapObject->PresentUserId;
			if (property_exists($objSoapObject, 'ItemId'))
				$objToReturn->intItemId = $objSoapObject->ItemId;
			if (property_exists($objSoapObject, 'Price'))
				$objToReturn->intPrice = $objSoapObject->Price;
			if (property_exists($objSoapObject, 'TaxWithin'))
				$objToReturn->intTaxWithin = $objSoapObject->TaxWithin;
			if (property_exists($objSoapObject, 'Count'))
				$objToReturn->intCount = $objSoapObject->Count;
			if (property_exists($objSoapObject, 'PresentStatus'))
				$objToReturn->intPresentStatus = $objSoapObject->PresentStatus;
			if (property_exists($objSoapObject, 'LicenseDay'))
				$objToReturn->intLicenseDay = $objSoapObject->LicenseDay;
			if (property_exists($objSoapObject, 'Subscription'))
				$objToReturn->strSubscription = $objSoapObject->Subscription;
			if (property_exists($objSoapObject, 'Image'))
				$objToReturn->strImage = $objSoapObject->Image;
			if (property_exists($objSoapObject, 'Simage'))
				$objToReturn->strSimage = $objSoapObject->Simage;
			if (property_exists($objSoapObject, 'GetDate'))
				$objToReturn->dttGetDate = new QDateTime($objSoapObject->GetDate);
			if (property_exists($objSoapObject, 'SuspendDate'))
				$objToReturn->dttSuspendDate = new QDateTime($objSoapObject->SuspendDate);
			if (property_exists($objSoapObject, 'PresentDate'))
				$objToReturn->dttPresentDate = new QDateTime($objSoapObject->PresentDate);
			if (property_exists($objSoapObject, 'TimeupDate'))
				$objToReturn->dttTimeupDate = new QDateTime($objSoapObject->TimeupDate);
			if (property_exists($objSoapObject, 'Suspended'))
				$objToReturn->strSuspended = $objSoapObject->Suspended;
			if (property_exists($objSoapObject, 'Present'))
				$objToReturn->strPresent = $objSoapObject->Present;
			if (property_exists($objSoapObject, 'Timeup'))
				$objToReturn->strTimeup = $objSoapObject->Timeup;
			if (property_exists($objSoapObject, 'Active'))
				$objToReturn->strActive = $objSoapObject->Active;
			if (property_exists($objSoapObject, '__blnRestored'))
				$objToReturn->__blnRestored = $objSoapObject->__blnRestored;
			return $objToReturn;
		}

		public static function GetSoapArrayFromArray($objArray) {
			if (!$objArray)
				return null;

			$objArrayToReturn = array();

			foreach ($objArray as $objObject)
				array_push($objArrayToReturn, TableUserItem::GetSoapObjectFromObject($objObject, true));

			return unserialize(serialize($objArrayToReturn));
		}

		public static function GetSoapObjectFromObject($objObject, $blnBindRelatedObjects) {
			if ($objObject->objUser)
				$objObject->objUser = TableUserProject::GetSoapObjectFromObject($objObject->objUser, false);
			else if (!$blnBindRelatedObjects)
				$objObject->intUserId = null;
			if ($objObject->dttGetDate)
				$objObject->dttGetDate = $objObject->dttGetDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttSuspendDate)
				$objObject->dttSuspendDate = $objObject->dttSuspendDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttPresentDate)
				$objObject->dttPresentDate = $objObject->dttPresentDate->__toString(QDateTime::FormatSoap);
			if ($objObject->dttTimeupDate)
				$objObject->dttTimeupDate = $objObject->dttTimeupDate->__toString(QDateTime::FormatSoap);
			return $objObject;
		}




	}



	/////////////////////////////////////
	// ADDITIONAL CLASSES for QCubed QUERY
	/////////////////////////////////////

	class QQNodeTableUserItem extends QQNode {
		protected $strTableName = 'table_user_item';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserItem';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'PresentUserId':
					return new QQNode('present_user_id', 'PresentUserId', 'integer', $this);
				case 'ItemId':
					return new QQNode('item_id', 'ItemId', 'integer', $this);
				case 'Price':
					return new QQNode('price', 'Price', 'integer', $this);
				case 'TaxWithin':
					return new QQNode('tax_within', 'TaxWithin', 'integer', $this);
				case 'Count':
					return new QQNode('count', 'Count', 'integer', $this);
				case 'PresentStatus':
					return new QQNode('present_status', 'PresentStatus', 'integer', $this);
				case 'LicenseDay':
					return new QQNode('license_day', 'LicenseDay', 'integer', $this);
				case 'Subscription':
					return new QQNode('subscription', 'Subscription', 'string', $this);
				case 'Image':
					return new QQNode('image', 'Image', 'string', $this);
				case 'Simage':
					return new QQNode('simage', 'Simage', 'string', $this);
				case 'GetDate':
					return new QQNode('get_date', 'GetDate', 'QDateTime', $this);
				case 'SuspendDate':
					return new QQNode('suspend_date', 'SuspendDate', 'QDateTime', $this);
				case 'PresentDate':
					return new QQNode('present_date', 'PresentDate', 'QDateTime', $this);
				case 'TimeupDate':
					return new QQNode('timeup_date', 'TimeupDate', 'QDateTime', $this);
				case 'Suspended':
					return new QQNode('suspended', 'Suspended', 'string', $this);
				case 'Present':
					return new QQNode('present', 'Present', 'string', $this);
				case 'Timeup':
					return new QQNode('timeup', 'Timeup', 'string', $this);
				case 'Active':
					return new QQNode('active', 'Active', 'string', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

	class QQReverseReferenceNodeTableUserItem extends QQReverseReferenceNode {
		protected $strTableName = 'table_user_item';
		protected $strPrimaryKey = 'id';
		protected $strClassName = 'TableUserItem';
		public function __get($strName) {
			switch ($strName) {
				case 'Id':
					return new QQNode('id', 'Id', 'integer', $this);
				case 'UserId':
					return new QQNode('user_id', 'UserId', 'integer', $this);
				case 'User':
					return new QQNodeTableUserProject('user_id', 'User', 'integer', $this);
				case 'PresentUserId':
					return new QQNode('present_user_id', 'PresentUserId', 'integer', $this);
				case 'ItemId':
					return new QQNode('item_id', 'ItemId', 'integer', $this);
				case 'Price':
					return new QQNode('price', 'Price', 'integer', $this);
				case 'TaxWithin':
					return new QQNode('tax_within', 'TaxWithin', 'integer', $this);
				case 'Count':
					return new QQNode('count', 'Count', 'integer', $this);
				case 'PresentStatus':
					return new QQNode('present_status', 'PresentStatus', 'integer', $this);
				case 'LicenseDay':
					return new QQNode('license_day', 'LicenseDay', 'integer', $this);
				case 'Subscription':
					return new QQNode('subscription', 'Subscription', 'string', $this);
				case 'Image':
					return new QQNode('image', 'Image', 'string', $this);
				case 'Simage':
					return new QQNode('simage', 'Simage', 'string', $this);
				case 'GetDate':
					return new QQNode('get_date', 'GetDate', 'QDateTime', $this);
				case 'SuspendDate':
					return new QQNode('suspend_date', 'SuspendDate', 'QDateTime', $this);
				case 'PresentDate':
					return new QQNode('present_date', 'PresentDate', 'QDateTime', $this);
				case 'TimeupDate':
					return new QQNode('timeup_date', 'TimeupDate', 'QDateTime', $this);
				case 'Suspended':
					return new QQNode('suspended', 'Suspended', 'string', $this);
				case 'Present':
					return new QQNode('present', 'Present', 'string', $this);
				case 'Timeup':
					return new QQNode('timeup', 'Timeup', 'string', $this);
				case 'Active':
					return new QQNode('active', 'Active', 'string', $this);

				case '_PrimaryKeyNode':
					return new QQNode('id', 'Id', 'integer', $this);
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}
	}

?>